package com.project.service.impl;

import com.project.bean.CommodityBean;
import com.project.bean.CutPageBean;
import com.project.dao.ICommentDao;
import com.project.dao.ICommodityDao;
import com.project.service.ICommodityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

@Service
public class CommodityServiceImpl implements ICommodityService {
    @Autowired
    private ICommodityDao commodityDao;
    @Autowired
    private ICommentDao commentDao;
    @Override
    public CutPageBean<CommodityBean> findByItem(Integer pageNO, String name) {
        return commodityDao.findByItem(pageNO, name);
    }

    @Override
    public CommodityBean findById(Integer id) {
        CommodityBean commodity = commodityDao.findById(id);
        commodity.setCommentList(commentDao.findByCommodity(id));
        return commodity;
    }
}
